import { http } from "@/utils/http";
import type { ResultTable } from "@/api/type";
import type { FormItemProps, Result } from "@/views/learn/articles/utils/types";

const modulePath = "/learn/articles";

/** 文章列表 */
export const getArticlesList = (params?: object) => {
  return http.request<ResultTable>("get", modulePath + "/list", {
    params
  });
};

/** 新增 */
export const articlesAdd = (data?: FormItemProps) => {
  return http.request<Result>("post", modulePath + "/add", { data });
};

/** 修改 */
export const articlesUpdate = (data?: FormItemProps) => {
  return http.request<Result>("put", modulePath + "/update", {
    data
  });
};

/** 删除 */
export const articlesDel = (data: object) => {
  return http.request<Result>("delete", modulePath + "/delete", {
    data
  });
};
